﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using proRFID_DiemDanh.Chung;

namespace proRFID_DiemDanh.MonHoc
{
    public partial class ThemMonHoc : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                txt_TenMH.Focus();
        }

        protected void Imgcmd_ThemMH_Click(object sender, ImageClickEventArgs e)
        {
            DataTable dt = new DataTable();
            dt = mdMonHoc.sp_MONHOC_Insert(txt_TenMH.Text.Trim());
            if (dt.Rows[0]["ErrCode"].ToString() == "0")
            {
                mdMain.OKCancelBox(this, dt.Rows[0]["ErrMsg"].ToString() + ". Bạn có muốn thêm nữa không?", "/Monhoc/Monhoc.aspx");
                txt_TenMH.Text = "";
                txt_TenMH.Focus();
            }
            else
            {
                mdMain.OKCancelBox(this, dt.Rows[0]["ErrMsg"].ToString() + ". Bạn có muốn thử lại không?", "/Monhoc/Monhoc.aspx");
                txt_TenMH.Focus();
            }
        }

    }
}